package com.bmadmin.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bmadmin.domain.LayUiDataTablePOJO;
import com.bmadmin.domain.MessageDomain;
import com.bmadmin.domain.NormalResult;
import com.bmadmin.mapper.BatchSendDao;
import com.bmadmin.mapper.DelaySendDao;
import com.bmadmin.service.DelaySendService;

@Service
@Transactional
public class DelaySendServiceImpl implements  DelaySendService{
	@Autowired
	DelaySendDao delayhSendDao;
	
	public void InsertMessageDelay(MessageDomain message){
		delayhSendDao.InsertMessageDelay(message);
	}
	
	public LayUiDataTablePOJO getDelayMessage(MessageDomain message){
		LayUiDataTablePOJO result = new LayUiDataTablePOJO();

        List<MessageDomain> messageDomain = delayhSendDao.find(message);
        result.setCode(0);
        result.setMsg("查询成功");
        result.setData(messageDomain);
        result.setCount(messageDomain.size());
        return result;
	}
	
	public NormalResult deleteDelayMessage(String s_id){
		NormalResult result = new NormalResult();
        int deleteResult = delayhSendDao.deleteDelayMessage(s_id);
        if(deleteResult==1){
            result.setCode("0000");
            result.setMsg("删除成功");
        }else{
            result.setCode("9999");
            result.setMsg("删除失败");
        }
        return result;
	}
	
	public List<MessageDomain> getDelayMessageList(MessageDomain message){
		return delayhSendDao.find(message);
	}
	
	public void UpdateDelayBz(String s_id, String content){
		delayhSendDao.UpdateDelayBz(s_id,content);
	}
	
}
